<template>
  <view class="new">
		<uni-notice-bar :showIcon="true" :scrollable="true" :single="true" @click="toApply"
			text="新店正在火热报名中,点击即可进入报名通道!"></uni-notice-bar>
		<view v-for="(item, index) in shopList" :key="index">
			<uni-card
        :title="item.name"
        mode="style"
        :is-shadow="true"
        :thumbnail="item.photo"
        :extra="item.time"
        :note="'地址：'
				+ item.address"
    	>
			{{item.description}}
    	</uni-card>
		</view>
  </view>
</template>

<script>
import {uniCard, uniNoticeBar} from '@dcloudio/uni-ui'
import {mapState} from 'vuex'
import {getStore} from '@/api/shop';
export default {
  name: 'home-new',
  components: {
    uniCard, uniNoticeBar
	},
	computed: {
	...mapState(['userInfo'])
	},
	mounted() {
		console.log(this.userInfo)
		this.getData()
	},
  data() {
		return {
			shopList: [
				// {
				// 	shopName: '【宣传示例】XX的奶茶店',
				// 	time: '2020-11-11 11:11:11',
				// 	introduction: 'XX的奶茶店开张了，凡在小明的校园美食点评带上店铺的照片和评价，点赞数超过20，评论数超过10即可获得免费珍珠奶茶一杯，隔壁的狗子们都馋哭了！',
				// 	address: '东南门左转200米',
				// 	imgUrl: require('../../../static/nwm.jpg')
				// },
				// {
				// 	shopName: '【宣传示例】XX的火锅店',
				// 	time: '2020-12-12 12:12:12',
				// 	introduction: 'XX的火锅店开张了，凡在小明的校园美食点评带上店铺的照片和评价，点赞数超过20，评论数超过10即可获得免费火锅底料一份，隔壁的狗子们都馋哭了！',
				// 	address: '东南门左转1000米',
				// 	imgUrl: require('../../../static/jxd.jpg')
				// }
			]
		}
	},
  methods:{
	  toApply(){
		  uni.navigateTo({
		  	url: '/pages/signup/signup-shop'
		  })
		},
		getData() {
			// const data = {
			// 	pageNum: 1,
			// 	pageSize: 20
			// }
			getStore(1,20).then(res => {
				if(res.code !== 200) {
					uni.showToast({
						title: res.message,
						icon: 'none'
					})
				}
				console.log(res.data)
				this.shopList = res.data.list
			})
		},
  }
}
</script>

<style lang="scss">
	/* #ifdef MP-BAIDU */
	@font-face {
		font-family: uniicons;
		font-weight: normal;
		font-style: normal;
		src: url("~@/static/uni.ttf") format("truetype");
	}
	/* #endif */
  .new {
    width: 100%;
  }
</style>